cmake_minimum_required(VERSION 3.12)
project(kinect_azure)
set(CMAKE_CXX_STANDARD 14)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release)
set(CMAKE_C_FLAGS_RELEASE  "${CMAKE_C_FLAGS_RELEASE} -Wall -O3 -march=native")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -pg -march=native")
set(CMAKE_CXX_FLAGS_RELEASE   "${CMAKE_CXX_FLAGS_RELEASE} -Wall -O3 -march=native")
set(CMAKE_CXX_FLAGS_DEBUG    "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pg -march=native")
find_package(OpenCV 4 REQUIRED)#使用opencv3显示图像，在代码结束时会出现段错误，会导致录制视频失败
find_package(PCL REQUIRED)
find_package(Boost  REQUIRED COMPONENTS system thread)
include_directories(${PCL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
find_package(k4a REQUIRED)
find_package(k4arecord REQUIRED)
if (NOT OPENMP_FOUND)
    find_package(OpenMP)
endif ()
if (OPENMP_FOUND)
    message(STATUS "Found openmp")
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
file(GLOB SRC_LIST *.cpp)
set(INC_DIR  lib)
set(LIB_DIR  lib)
include_directories(${INC_DIR})
link_directories(${LIB_DIR})
link_libraries(kinectv3 libkinectv3.so)
add_executable(test main.cpp)
target_include_directories(test PUBLIC ${K4A_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ./)
target_link_libraries(test
        k4a::k4a
        k4a::k4arecord
        ${OpenCV_LIBRARIES}
        ${PCL_LIBRARIES}
        ${Boost_LIBRARIES}
        kinectv3
        )
